package com.zwx.bingo.abstraction.service;

import com.zwx.bingo.data.body.AbstractQueryRequestBody;
import com.zwx.bingo.data.body.PageResponseBody;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * An abstract find service with paginated result
 *
 * @author zoo
 * @since 2.0.3
 */
public interface ConditionalService<ENTITY, QUERY extends AbstractQueryRequestBody> {

    /**
     * paginated returning according query request body and pageable
     */
    public PageResponseBody<ENTITY> findAllByCondition(QUERY queryRequestBody, Pageable pageable);

    /**
     * list returning according query request body and pageable
     */
    public List<ENTITY> findAllByCondition(QUERY queryRequestBody);

    /**
     * @param queryRequestBody
     * @return
     */
    public Long countByCondition(QUERY queryRequestBody);

    /**
     * @param queryRequestBody
     * @return
     */
    public Boolean existsByCondition(QUERY queryRequestBody);

    /**
     * @param queryRequestBody
     * @return
     */
    public Integer deleteByCondition(QUERY queryRequestBody);

}
